# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pype32
pkgname=('python2-pype32' 'python-pype32')
_pkgname=pype32
pkgver=0.1
pkgrel=11
pkgdesc='Yet another Python library to read and write PE/PE+ files.'
arch=('any')
url='https://pypi.org/project/pype32/#files'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-v$pkgver-alpha5.zip")
sha512sums=('2ef3f82b6d721f245124d2070fbcbfc34570aab2d8e2b083db82ca8649a2ef9e73885d7cb6424d4e529a0de4e14d7e60d12d9d8c7ee43e552f0a323327176ecd')

prepare() {
  cp -a "$_pkgname-$pkgver-alpha5" "$_pkgname-$pkgver-alpha5-2"
}

build() {
  cd "$_pkgname-$pkgver-alpha5-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver-alpha5"

  python setup.py build
}

package_python2-pype32() {
  depends=('python2')

  cd "$_pkgname-$pkgver-alpha5-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/readpe.py" "$pkgdir/usr/bin/readpe2.py"
}

package_python-pype32() {
  depends=('python')

  cd "$_pkgname-$pkgver-alpha5"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

